package com.tudouji.project.bill.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tudouji.project.bill.mapper.DiscountMapper;
import com.tudouji.project.bill.domain.Discount;
import com.tudouji.project.bill.service.IDiscountService;

/**
 * 折扣Service业务层处理
 * 
 * @author tudouji
 * @date 2021-04-29
 */
@Service
public class DiscountServiceImpl implements IDiscountService 
{
    @Autowired
    private DiscountMapper discountMapper;

    /**
     * 查询折扣
     * 
     * @param id 折扣ID
     * @return 折扣
     */
    @Override
    public Discount selectDiscountById(Long id)
    {
        return discountMapper.selectDiscountById(id);
    }

    /**
     * 查询折扣列表
     * 
     * @param discount 折扣
     * @return 折扣
     */
    @Override
    public List<Discount> selectDiscountList(Discount discount)
    {
        return discountMapper.selectDiscountList(discount);
    }

    /**
     * 新增折扣
     * 
     * @param discount 折扣
     * @return 结果
     */
    @Override
    public int insertDiscount(Discount discount)
    {
        return discountMapper.insertDiscount(discount);
    }

    /**
     * 修改折扣
     * 
     * @param discount 折扣
     * @return 结果
     */
    @Override
    public int updateDiscount(Discount discount)
    {
        return discountMapper.updateDiscount(discount);
    }

    /**
     * 批量删除折扣
     * 
     * @param ids 需要删除的折扣ID
     * @return 结果
     */
    @Override
    public int deleteDiscountByIds(Long[] ids)
    {
        return discountMapper.deleteDiscountByIds(ids);
    }

    /**
     * 删除折扣信息
     * 
     * @param id 折扣ID
     * @return 结果
     */
    @Override
    public int deleteDiscountById(Long id)
    {
        return discountMapper.deleteDiscountById(id);
    }
}
